////////////////////////////
// OzZ Controls Visualizator Plugin
//// This Class cares about the visualisation of OzZ-Controls
//// Include this directly for a plugin-project!
//// Include OzZcontrols.h to your application-project instead
//// (c) Copyright by Daniel Bulla 2006

#pragma once

#include "OzZtypes.h"

#ifdef PLUGIN_EXPORT
#define PLUGIN_API __declspec(dllexport)
#else
#define PLUGIN_API __declspec(dllimport)
#endif

namespace oc
{
	struct PrivateData;
}
					 /**	the bool values here return XXX?!? if the function has returned a error in hTransData
					  *	it can be NOTXXX?!? and return something in hTransData that is not an error
					  */

class PLUGIN_API oc::CVisualizator
{
	PrivateData*	m_pPD;
public:
					/// indicates if the renderer will interpolate manualy between two points
					/** ...or if a line should be splitted into linear parts by the framework itself
					 */
	const bool		m_bLineInterpolation;	

	TransData		m_TransData;

	virtual bool	Init() = 0;				///< Called once on Startup
	virtual bool	Prepair() = 0;			///< Called once on Startup and	on Reset
	virtual bool	OnResetDevice() = 0;	///< Called						on Reset
	virtual bool	OnLostDevice() = 0;		///< Called						on Lost
	virtual bool	CleanUp() = 0;			///< Called once in the End and	on Lost
	virtual bool	FinalCleanUp() = 0;		///< Called once in the End

					/// Called when a member of an Element is set, so the plugin can react and update it's costume data
	virtual bool	Update(ElementPaper* pElem, MPOINTER pMember) = 0;


	virtual bool	PreDraw() = 0;	///< Called once before Drawing
	virtual bool	DrawElem(ElementPaper* pI) = 0;	///< Called once for every Element to be drawn!
	virtual bool	PostDraw() = 0;	///< Called once after Drawing

//	virtual bool	RegisterElem(HANDLE *ph, const char* pszFileOrFont, UINT flags);
//	virtual bool	FreeElem(HANDLE *ph);

	// todo: invent some create new point rules
	virtual bool	TakeLinePoint(const HANDLE hLine, RenderPoint& rp) = 0;
		// plugin takes a point to add to/update in the line
	virtual bool	TakeSinglePointMember(const HANDLE hLine, void* RenderPoint::* pMember, const int index, void* pValue) = 0;
		// plugin takes a singel point element

	virtual bool	WhatType(const HANDLE* const phWhat, eType* pOut) = 0;	// returns the Elements type

	virtual bool	AllocCMat(CostumeMat* &pOut) = 0;
			// allocates memory for 
	virtual bool	FreeCMat(CostumeMat* &pIn) = 0;
			// frees it
	virtual bool	CopyCMat(CostumeMat* pSet, const CostumeMat* pToCopy) = 0;
			// copys it
	virtual bool	MakeCMat(CostumeMat* pOut, const Coord1D x, const Coord1D y, const float sx, const float sy, const float angle, const Coord1D centerX, const Coord1D centerY) = 0;
			// fills it and calculates it from the raw input data
	virtual bool	MultCMat(CostumeMat* pResult, const CostumeMat* const pOp1, const CostumeMat* const pOp2) = 0;
			// multyplies two CostumeMatrices (used to set an element as the child of an other)
	virtual bool	TransPoints(Coord2D_si* const pResults, const Coord2D_si* const pPoints, const unsigned int uiNoOfP, const CostumeMat* const pFrom, const CostumeMat* const pTo) = 0;
			//used to get a points position inside an element
	virtual bool	CheckPointsOver(CollisionInfo*	const pResults, const ElementPaper* const pRD, Coord2D_si* const pPoints, const unsigned int uiNoOfP) = 0;
			// TODO: if XXX??! is returned and trans data is GUI_CHECKCOLLISION_DEFAULT the app calculates it
//TODO:	virtual bool	CheckPointsOverWhitch(CGUIPoint* paPoints);	// return elem // has to do the app, not the plugin

	virtual const char* TransDataToText() const = 0;


	CVisualizator();
	~CVisualizator();
	// circle, poly, IDEAS ?

};

extern "C"
{
PLUGIN_API void* GetData(void);
PLUGIN_API void FreeData(void);
}